<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>电梯维保记录管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {

        });

        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }

        function printRecord(id) {
            openwindow("${pageContext.request.contextPath}/f/sydwfront/mainPrint?recordId=" + id, "打印维保记录", 1200, 650);
        }

        function openwindow(url, name, iWidth, iHeight) {
            var url; //转向网页的地址;
            var name; //网页名称，可为空;
            var iWidth; //弹出窗口的宽度;
            var iHeight; //弹出窗口的高度;
            //window.screen.height获得屏幕的高，window.screen.width获得屏幕的宽
            var iTop = (window.screen.height - 30 - iHeight) / 2; //获得窗口的垂直位置;
            var iLeft = (window.screen.width - 10 - iWidth) / 2; //获得窗口的水平位置;
            window.open(url, name, 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
        }
    </script>
</head>
<body>
<form:form id="searchForm" modelAttribute="maintenanceRecordSz" action="${pageContext.request.contextPath}/f/sydwfront/mainList" method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <input id="deviceCode" name="deviceCode" type="hidden" value="${deviceCode}"/>

    <div class="container-fluid">
        <div class="row">
            <div class="control-label col-xs-12">
                <label>维保记录编号：</label>
                <form:input path="recordNo" htmlEscape="false" maxlength="20" class="form-control input-sm input-medium"/>

                <label>维保单位名称：</label>
                <form:input path="maintenUnitName" htmlEscape="false" maxlength="100" class="form-control input-sm input-medium"/>

                <label>维保类型：</label>
                <form:select path="maintenanceType" class="form-control input-sm input-medium">
                    <form:option value="" label=""/>
                    <form:options items="${fns:getDictList('MT_TYPE')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                </form:select>
                <label>维保结论：</label>
                <form:select path="maintenanceResult" class="form-control input-sm input-medium">
                    <form:option value="" label=""/>
                    <form:options items="${fns:getDictList('MT_RESULT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                </form:select>

                <label>维保日期从：</label>
                <input name="noticeTime" type="text" readonly="readonly" maxlength="20" class="form-control input-sm input-medium Wdate"
                       value="<fmt:formatDate value="${maintenanceRecordSz.noticeTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                       onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                至
                <input name="noticeTime" type="text" readonly="readonly" maxlength="20" class="form-control input-sm input-medium Wdate"
                       value="<fmt:formatDate value="${maintenanceRecordSz.noticeTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                       onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>

                <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
            </div>
        </div>
    </div>
</form:form>
<sys:message content="${message}"/>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>维保记录编号</th>
        <th>设备注册代码</th>
        <th>使用单位名称</th>
        <th>单位内部编号</th>
        <th>设备所在地点</th>
        <th>维保类型</th>
        <th>维保结论</th>
        <th>开始时间</th>
        <th>结束时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${page.list}" var="maintenanceRecordSz">
        <tr>
            <td>
                <a href="${pageContext.request.contextPath}/f/sydwfront/mainForm?recordId=${maintenanceRecordSz.recordId}">${maintenanceRecordSz.recordNo}</a>
            </td>
            <td>
                    ${maintenanceRecordSz.deviceCode}
            </td>
            <td>
                    ${maintenanceRecordSz.useUnitName}
            </td>
            <td>
                    ${maintenanceRecordSz.internalCode}
            </td>
            <td>
                    ${maintenanceRecordSz.deviceAddr}
            </td>
            <td>
                <c:if test="${maintenanceRecordSz.halfmonthMainType eq '1'}">半月维保</c:if>
                <c:if test="${maintenanceRecordSz.quarterMainType eq '1'}">季度维保</c:if>
                <c:if test="${maintenanceRecordSz.halfyearMainType eq '1'}">半年维保</c:if>
                <c:if test="${maintenanceRecordSz.yearMainType eq '1'}">年度维保</c:if>
            </td>
            <td>
                    ${fns:getDictLabel(maintenanceRecordSz.maintenanceResult, 'MT_RESULT', '')}
            </td>
            <td>
                <fmt:formatDate value="${maintenanceRecordSz.signInTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
            </td>
            <td>
                <fmt:formatDate value="${maintenanceRecordSz.completionTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
            </td>
            <td>
                <a href="###" onclick="printRecord('${maintenanceRecordSz.recordId}')">打印</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div style="text-align: center;">
    <div class="pagination">${page}</div>
</div>
</body>
</html>